/**
 * Created by woziji00226 on 2024-12-11 10:30:16.
 */
class GUI_eatAppleRow_W26 extends GUI_15002 {

    private _canClick: boolean = false;


    constructor() {
        super();
        this.canClick = false;
        this.randomShowApple();

        this.once(GameSprite.ON_DISPOSE, this, () => {
            this.visiableContainer.graphics.clear();
            this.apple_0.dispose();
            this.apple_1.dispose();
            this.apple_2.dispose();
            this.apple_3.dispose();
        })

        //绘图分隔线
        this.visiableContainer.graphics.clear();
        this.visiableContainer.graphics.drawLine(0, 0, this.visiableContainer.width, 0, "#0000FF");
        for (var i = 1; i < 4; i++) {
            this.visiableContainer.graphics.drawLine(80 * i, 0, 80 * i, this.visiableContainer.height, "#0000FF");
        }

    }

    public playAnimi(){
        this.apple_0.playTimeOverAnimi();
        this.apple_1.playTimeOverAnimi();
        this.apple_2.playTimeOverAnimi();
        this.apple_3.playTimeOverAnimi();
    }


    public hideAllApple(){
        this.apple_0.visible = false;
        this.apple_1.visible = false;
        this.apple_2.visible = false;
        this.apple_3.visible = false;
    }

    /**
     * 随机显示一个位置的苹果
     */
    private randomShowApple() {
        //debugger;
        var randomIndex = Math.floor(Math.random() * 4);
        this["apple_" + randomIndex.toString()].status = EatAppleStatus_W26.Show;
    }

    public get canClick() {
        return this._canClick;
    }

    public set canClick(value: boolean) {
        this._canClick = value;
        this.apple_0.canClick = this._canClick;
        this.apple_1.canClick = this._canClick;
        this.apple_2.canClick = this._canClick;
        this.apple_3.canClick = this._canClick;
    }
}